<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.drawing.xaxis.js" ></script>
    <script src="../libraries/RGraph.scatter.js" ></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->
    
    <title>Trigonometry curves (sin, cos and tan)</title>
    
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A Scatter chart that shows trigonometry curves (sin, cos and tan)" />
     
</head>
<body>

    <h1>Trigonometry curves (sin, cos and tan)</h1>

    <canvas id="cvs" width="1000" height="200">[No canvas support]</canvas>
    
    <script>
        $(document).ready(function ()
        {
            var data_sin = [];
            var data_cos = [];
            var data_tan = [];

            for (var i=-360; i<360; i+=1) {
                data_sin.push([i, Math.sin(i / (180 / Math.PI))]);
                data_cos.push([i, Math.cos(i / (180 / Math.PI))]);
                
                var tan_value = Math.tan(i / (180 / Math.PI));
                data_tan.push([i, (tan_value < 1 && tan_value > -1) ? tan_value : null]);
            }

            var xaxis = new RGraph.Drawing.XAxis({
                id: 'cvs',
                y:100,
                options: {
                    scale: {
                        zerostart: false
                    },
                    yaxispos: 'center',
                    numlabels: 4,
                    numticks: 16,
                    max: 360
                }
            }).draw()

            var scatter = new RGraph.Scatter({
                id: 'cvs',
                data: [data_sin, data_cos, data_tan],
                options: {
                    ymax: 1,
                    xmax: 360,
                    scale: {
                        decimals: 1
                    },
                    gutter: {
                        left: 500
                    },
                    line: {
                        self: true,
                        linewidth: 3
                    },
                    tickmarks: null,
                    xaxispos: 'center',
                    xaxis: false,
                    background: {
                        grid: false
                    },
                    outofbounds: false
                }
            }).draw()
        })
    </script>

    <p>        
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>